<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="js/hanshu.js"></script> -->
</head>

<body>
    <script>
        // 使用函数求出数组中是否所有的数字都是正数
        // let arr = [10, 20, 30, 40, 50];
        let arr = [10, 20, 30, 40, 50];
        /* for (let i = 0; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i]
            }
        }
        // console.log(min);
        if (min < 0) {
            console.log('flase');
        } else {
            console.log('true');
        } */
        function yanZheng(a) {
            let min = Infinity;
            for (let i = 0; i < a.length; i++) {
                if (a[i] < min) {
                    min = a[i]
                }
            }
            if (min < 0) {
                min = 'true'
            } else {
                min = 'flase'
            }
            return min;
        }
        let res = yanZheng(arr)
        console.log(res);
    </script>
</body>

</html>